home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 2010 April / PCWorld0410.iso / hity wydania / Ubuntu 9.10 PL / karmelkowy-koliberek-desktop-9.10-i386-PL.iso / casper / filesystem.squashfs / var / lib / dpkg / info / libssl0.9.8.postinst < prev    next >
Text File  |  2009-09-09  |  5KB  |  181 lines

  1. #!/bin/bash
  2.  
  3. . /usr/share/debconf/confmodule
  4.  
  5. set -e
  6.  
  7. package_name()
  8. {
  9.     echo $(basename $0 .postinst)
  10. }
  11.  
  12. # element() is a helper function for file-rc:
  13. element() {
  14.     local element list IFS
  15.  
  16.     element="$1"
  17.  
  18.     [ "$2" = "in" ] && shift
  19.     list="$2"
  20.     [ "$list" = "-" ] && return 1
  21.     [ "$list" = "*" ] && return 0
  22.  
  23.     IFS=","
  24.     set -- $list
  25.     case $element in
  26.     "$1"|"$2"|"$3"|"$4"|"$5"|"$6"|"$7"|"$8"|"$9")
  27.         return 0
  28.     esac
  29.     return 1
  30. }
  31.  
  32. # filerc (runlevel, service) returns /etc/init.d/service, if service is
  33. # running in $runlevel:
  34. filerc() {
  35.     local runlevel basename
  36.     runlevel=$1
  37.     basename=$2
  38.     while read LINE
  39.     do
  40.     case $LINE in
  41.         \#*|"") continue
  42.     esac
  43.  
  44.     set -- $LINE
  45.     SORT_NO="$1"; STOP="$2"; START="$3"; CMD="$4"
  46.     [ "$CMD" = "/etc/init.d/$basename" ] || continue
  47.  
  48.     if element "$runlevel" in "$START" || element "S" in "$START"
  49.     then
  50.         echo "/etc/init.d/$basename"
  51.         return 0
  52.     fi
  53.     done < /etc/runlevel.conf
  54.     echo ""
  55. }
  56.  
  57. if [ "$1" = "configure" ]
  58. then
  59.     if [ ! -z "$2" ]; then
  60.     if dpkg --compare-versions "$2" lt 0.9.8g-9 && dpkg --compare-versions "$2" gt 0.9.8c-4etch3; then
  61.         db_version 2.0
  62.  
  63.         echo -n "Checking for services that may need to be restarted..."
  64.  
  65.         check="sendmail openssh-server"
  66.         check="$check apache2-common ssh-nonfree exim4"
  67.         check="$check apache-ssl libapache-mod-ssl openvpn spamassassin"
  68.         check="$check courier-imap-ssl courier-mta-ssl courier-pop-ssl"
  69.         check="$check postfix cyrus21-imapd cyrus21-pop3d"
  70.         check="$check postgresql-7.4 postgresql-8.0 postgresql-8.1"
  71.         check="$check postgresql-8.2"
  72.         check="$check racoon dovecot-common bind9"
  73.         check="$check ntp openntpd clamcour nagios-nrpe-server"
  74.         check="$check clamav-freshclam clamav-daemon"
  75.         check="$check fetchmail ftpd-ssl slapd"
  76.         check="$check proftpd proftpd-ldap proftpd-mysql proftpd-pgsql"
  77.         check="$check partimage-server conserver-server tor"
  78.         check="$check stunnel4"
  79.         # Only get the ones that are installed, and configured
  80.         check=$(dpkg -s $check 2> /dev/null | egrep '^Package:|^Status:' | awk '{if ($1 ~ /^Package:/) { package=$2 } else if ($0 ~ /^Status: .* installed$/) { print package }}')
  81.         # apache2 ships its init script in apache2-common, but the
  82.         # script is apache2
  83.         check=$(echo $check | sed 's/apache2-common/apache2/g')
  84.         # For mod-ssl apache has to be restarted
  85.         check=$(echo $check | sed 's/libapache-mod-ssl/apache/g')
  86.         # The name of proftpd-{ldap,mysql,pgsql} init script is
  87.         # same as "proftpd".
  88.         check=$(echo $check | sed 's/proftpd-.*/proftpd/g')
  89.             # dovecot-common ships its init script, but the
  90.         # script name is dovecot for dovecot-{imapd,pop3d}.
  91.         check=$(echo $check | sed 's/dovecot-common/dovecot/g')
  92.         # openssh-server's init script it called ssh
  93.         check=$(echo $check | sed 's/openssh-server/ssh/g')
  94.         echo "done."
  95.  
  96.         echo "Checking init scripts..."
  97.         for service in $check; do
  98.         if [ -x "`which invoke-rc.d 2>/dev/null`" ]; then
  99.            idl=$(ls /etc/init.d/${service} 2> /dev/null | head -n 1)
  100.            if [ -n "$idl" ] && [ -x $idl ]; then
  101.             services="$service $services"
  102.            else
  103.             echo "WARNING: init script for $service not found."
  104.            fi
  105.         else
  106.             if [ -f /usr/share/file-rc/rc ] || [ -f /usr/lib/file-rc/rc ] && [ -f /etc/runlevel.conf ]; then
  107.  
  108.             idl=$(filerc $rl $service)
  109.             else
  110.             idl=$(ls /etc/rc${rl}.d/S??${service} 2> /dev/null | head -n 1)
  111.             fi
  112.             if [ -n "$idl" ] && [ -x $idl ]; then
  113.                 services="$service $services"
  114.             fi
  115.         fi
  116.         done
  117.         if [ -n "$services" ]; then
  118.         db_reset libssl0.9.8/restart-services
  119.         db_set libssl0.9.8/restart-services "$services"
  120.         if [ "$RELEASE_UPGRADE_MODE" = desktop ]; then
  121.             db_input medium libssl0.9.8/restart-services || true
  122.         else
  123.             db_input critical libssl0.9.8/restart-services || true
  124.         fi
  125.         db_go || true
  126.         db_get libssl0.9.8/restart-services
  127.         
  128.         if [ "x$RET" != "x" ]
  129.         then
  130.             services=$RET
  131.             answer=yes
  132.         else
  133.             answer=no
  134.         fi
  135.         echo
  136.         if [ "$answer" = yes ] && [ "$services" != "" ]; then
  137.             echo "Restarting services possibly affected by the upgrade:"
  138.             failed=""
  139.             rl=$(runlevel | sed 's/.*\ //')
  140.             for service in $services; do
  141.             if [ -x "`which invoke-rc.d 2>/dev/null`" ]; then
  142.                 idl="invoke-rc.d ${service}"
  143.             elif [ -f /usr/share/file-rc/rc ] || [ -f /usr/lib/file-rc/rc ] && [ -f /etc/runlevel.conf ]; then
  144.                 idl=$(filerc $rl $service)
  145.             else
  146.                 idl=$(ls /etc/rc${rl}.d/S??${service} 2> /dev/null | head -n 1)
  147.             fi
  148.  
  149.             if ! $idl restart; then
  150.                 failed="$service $failed"
  151.             fi
  152.             done
  153.             echo
  154.             if [ -n "$failed" ]; then
  155.             db_subst libssl0.9.8/restart-failed services "$failed"
  156.             db_input critical libssl0.9.8/restart-failed || true
  157.             db_go || true
  158.             else
  159.             echo "Services restarted successfully."
  160.             fi
  161.             echo
  162.         fi
  163.         else
  164.         echo "Nothing to restart."
  165.         fi
  166.         # Shut down the frontend, to make sure none of the
  167.         # restarted services keep a connection open to it
  168.         db_stop
  169.     fi # end upgrading and $2 lt 0.9.8c-2
  170.     fi # Upgrading
  171.  
  172.     [ -x /usr/share/update-notifier/notify-reboot-required ] && /usr/share/update-notifier/notify-reboot-required
  173. fi
  174.  
  175. # Automatically added by dh_makeshlibs
  176. if [ "$1" = "configure" ]; then
  177.     ldconfig
  178. fi
  179. # End automatically added section
  180.  
  181.